/*
 *
 * Copyright 2020 gRPC authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

#include <grpc/impl/codegen/port_platform.h>

#include "src/core/ext/transport/cronet/transport/cronet_status.h"

const char* cronet_status_as_string(cronet_status_code status) {
  switch (status) {
    case CRONET_STATUS_SUCCESS:
      return "CRONET_STATUS_SUCCESS.";
    case CRONET_STATUS_ILLEGAL_ARGUMENT:
      return "CRONET_STATUS_ILLEGAL_ARGUMENT.";
    case CRONET_STATUS_ILLEGAL_ARGUMENT_STORAGE_PATH_MUST_EXIST:
      return "CRONET_STATUS_ILLEGAL_ARGUMENT_STORAGE_PATH_MUST_EXIST.";
    case CRONET_STATUS_ILLEGAL_ARGUMENT_INVALID_PIN:
      return "CRONET_STATUS_ILLEGAL_ARGUMENT_INVALID_PIN.";
    case CRONET_STATUS_ILLEGAL_ARGUMENT_INVALID_HOSTNAME:
      return "CRONET_STATUS_ILLEGAL_ARGUMENT_INVALID_HOSTNAME.";
    case CRONET_STATUS_ILLEGAL_ARGUMENT_INVALID_HTTP_METHOD:
      return "CRONET_STATUS_ILLEGAL_ARGUMENT_INVALID_HTTP_METHOD.";
    case CRONET_STATUS_ILLEGAL_ARGUMENT_INVALID_HTTP_HEADER:
      return "CRONET_STATUS_ILLEGAL_ARGUMENT_INVALID_HTTP_HEADER.";
    case CRONET_STATUS_ILLEGAL_STATE:
      return "CRONET_STATUS_ILLEGAL_STATE.";
    case CRONET_STATUS_ILLEGAL_STATE_STORAGE_PATH_IN_USE:
      return "CRONET_STATUS_ILLEGAL_STATE_STORAGE_PATH_IN_USE.";
    case CRONET_STATUS_ILLEGAL_STATE_CANNOT_SHUTDOWN_ENGINE_FROM_NETWORK_THREAD:
      return "CRONET_STATUS_ILLEGAL_STATE_CANNOT_SHUTDOWN_ENGINE_FROM_NETWORK_"
             "THREAD.";
    case CRONET_STATUS_ILLEGAL_STATE_ENGINE_ALREADY_STARTED:
      return "CRONET_STATUS_ILLEGAL_STATE_ENGINE_ALREADY_STARTED.";
    case CRONET_STATUS_ILLEGAL_STATE_REQUEST_ALREADY_STARTED:
      return "CRONET_STATUS_ILLEGAL_STATE_REQUEST_ALREADY_STARTED.";
    case CRONET_STATUS_ILLEGAL_STATE_REQUEST_NOT_INITIALIZED:
      return "CRONET_STATUS_ILLEGAL_STATE_REQUEST_NOT_INITIALIZED.";
    case CRONET_STATUS_ILLEGAL_STATE_REQUEST_ALREADY_INITIALIZED:
      return "CRONET_STATUS_ILLEGAL_STATE_REQUEST_ALREADY_INITIALIZED.";
    case CRONET_STATUS_ILLEGAL_STATE_REQUEST_NOT_STARTED:
      return "CRONET_STATUS_ILLEGAL_STATE_REQUEST_NOT_STARTED.";
    case CRONET_STATUS_ILLEGAL_STATE_UNEXPECTED_REDIRECT:
      return "CRONET_STATUS_ILLEGAL_STATE_UNEXPECTED_REDIRECT.";
    case CRONET_STATUS_ILLEGAL_STATE_UNEXPECTED_READ:
      return "CRONET_STATUS_ILLEGAL_STATE_UNEXPECTED_READ.";
    case CRONET_STATUS_ILLEGAL_STATE_READ_FAILED:
      return "CRONET_STATUS_ILLEGAL_STATE_READ_FAILED.";
    case CRONET_STATUS_NULL_POINTER:
      return "CRONET_STATUS_NULL_POINTER.";
    case CRONET_STATUS_NULL_POINTER_HOSTNAME:
      return "CRONET_STATUS_NULL_POINTER_HOSTNAME.";
    case CRONET_STATUS_NULL_POINTER_SHA256_PINS:
      return "CRONET_STATUS_NULL_POINTER_SHA256_PINS.";
    case CRONET_STATUS_NULL_POINTER_EXPIRATION_DATE:
      return "CRONET_STATUS_NULL_POINTER_EXPIRATION_DATE.";
    case CRONET_STATUS_NULL_POINTER_ENGINE:
      return "CRONET_STATUS_NULL_POINTER_ENGINE.";
    case CRONET_STATUS_NULL_POINTER_URL:
      return "CRONET_STATUS_NULL_POINTER_URL.";
    case CRONET_STATUS_NULL_POINTER_CALLBACK:
      return "CRONET_STATUS_NULL_POINTER_CALLBACK.";
    case CRONET_STATUS_NULL_POINTER_EXECUTOR:
      return "CRONET_STATUS_NULL_POINTER_EXECUTOR.";
    case CRONET_STATUS_NULL_POINTER_METHOD:
      return "CRONET_STATUS_NULL_POINTER_METHOD.";
    case CRONET_STATUS_NULL_POINTER_HEADER_NAME:
      return "CRONET_STATUS_NULL_POINTER_HEADER_NAME.";
    case CRONET_STATUS_NULL_POINTER_HEADER_VALUE:
      return "CRONET_STATUS_NULL_POINTER_HEADER_VALUE";
    case CRONET_STATUS_NULL_POINTER_PARAMS:
      return "CRONET_STATUS_NULL_POINTER_PARAMS.";
    case CRONET_STATUS_NULL_POINTER_REQUEST_FINISHED_INFO_LISTENER_EXECUTOR:
      return "CRONET_STATUS_NULL_POINTER_REQUEST_FINISHED_INFO_LISTENER_"
             "EXECUTOR.";
  }
  return "UNAVAILABLE.";
}
